<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Class: Vertx::NetServer
  
    &mdash; Ruby API Doc
  
</title>

  <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />

  <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  hasFrames = window.top.frames.main ? true : false;
  relpath = '../';
  framesUrl = "../frames.html#!" + escape(window.location.href);
</script>


  <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>


  </head>
  <body>
    <div id="header">
      <div id="menu">
  
    <a href="../_index.html">Index (N)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../Vertx.html" title="Vertx (module)">Vertx</a></span></span>
     &raquo; 
    <span class="title">NetServer</span>
  

  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="../class_list.html">
      Class List
    </a>
  
    <a class="full_list_link" id="method_list_link"
        href="../method_list.html">
      Method List
    </a>
  
    <a class="full_list_link" id="file_list_link"
        href="../file_list.html">
      File List
    </a>
  
</div>
      <div class="clear"></div>
    </div>

    <iframe id="search_frame"></iframe>

    <div id="content"><h1>Class: Vertx::NetServer
  
  
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName">Object</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">Vertx::NetServer</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
  
    
      <dt class="r2">Includes:</dt>
      <dd class="r2"><span class='object_link'><a href="SSLSupport.html" title="Vertx::SSLSupport (module)">SSLSupport</a></span>, <span class='object_link'><a href="ServerSSLSupport.html" title="Vertx::ServerSSLSupport (module)">ServerSSLSupport</a></span>, <span class='object_link'><a href="ServerTCPSupport.html" title="Vertx::ServerTCPSupport (module)">ServerTCPSupport</a></span>, <span class='object_link'><a href="TCPSupport.html" title="Vertx::TCPSupport (module)">TCPSupport</a></span></dd>
      
    
  
  
  
    <dt class="r1 last">Defined in:</dt>
    <dd class="r1 last">src/main/api_shim/core/net.rb</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    Represents a TCP or SSL Server

When connections are accepted by the server
they are supplied to the user in the form of a <span class='object_link'><a href="NetSocket.html" title="Vertx::NetSocket (class)">NetSocket</a></span> instance that is passed via the handler
set using <span class='object_link'><a href="#connect_handler-instance_method" title="Vertx::NetServer#connect_handler (method)">#connect_handler</a></span>.

  </div>
</div>
<div class="tags">
  
<p class="tag_title">Author:</p>
<ul class="author">
  
    <li>
      
      
      
      
        
        <div class='inline'><a href="http://tfox.org" target="_parent" title="Tim Fox">Tim Fox</a></div>
      
    </li>
  
</ul>

</div>






  
    <h2>
      Instance Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#close-instance_method" title="#close (instance method)">- (Object) <strong>close</strong>(&amp;hndlr) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Close the server.</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#connect_handler-instance_method" title="#connect_handler (instance method)">- (NetServer) <strong>connect_handler</strong>(&amp;hndlr) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Supply a connect handler for this server.</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#host-instance_method" title="#host (instance method)">- (Object) <strong>host</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Get the host.</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#initialize-instance_method" title="#initialize (instance method)">- (NetServer) <strong>initialize</strong> </a>
    

    
  </span>
  
  
    <span class="note title constructor">constructor</span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Create a new NetServer.</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#listen-instance_method" title="#listen (instance method)">- (Object) <strong>listen</strong>(port, host = &quot;0.0.0.0&quot;, &amp;hndlr) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Instruct the server to listen for incoming connections.</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#port-instance_method" title="#port (instance method)">- (Object) <strong>port</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Get the port.</div></span>
  
</li>

      
    </ul>
  


  
  
  
  
  
  
  
  
  <h3 class="inherited">Methods included from <span class='object_link'><a href="SSLSupport.html" title="Vertx::SSLSupport (module)">SSLSupport</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="SSLSupport.html#key_store_password-instance_method" title="Vertx::SSLSupport#key_store_password (method)">#key_store_password</a></span>, <span class='object_link'><a href="SSLSupport.html#key_store_password%3D-instance_method" title="Vertx::SSLSupport#key_store_password= (method)">#key_store_password=</a></span>, <span class='object_link'><a href="SSLSupport.html#key_store_path-instance_method" title="Vertx::SSLSupport#key_store_path (method)">#key_store_path</a></span>, <span class='object_link'><a href="SSLSupport.html#key_store_path%3D-instance_method" title="Vertx::SSLSupport#key_store_path= (method)">#key_store_path=</a></span>, <span class='object_link'><a href="SSLSupport.html#ssl-instance_method" title="Vertx::SSLSupport#ssl (method)">#ssl</a></span>, <span class='object_link'><a href="SSLSupport.html#ssl%3D-instance_method" title="Vertx::SSLSupport#ssl= (method)">#ssl=</a></span>, <span class='object_link'><a href="SSLSupport.html#trust_store_password-instance_method" title="Vertx::SSLSupport#trust_store_password (method)">#trust_store_password</a></span>, <span class='object_link'><a href="SSLSupport.html#trust_store_password%3D-instance_method" title="Vertx::SSLSupport#trust_store_password= (method)">#trust_store_password=</a></span>, <span class='object_link'><a href="SSLSupport.html#trust_store_path-instance_method" title="Vertx::SSLSupport#trust_store_path (method)">#trust_store_path</a></span>, <span class='object_link'><a href="SSLSupport.html#trust_store_path%3D-instance_method" title="Vertx::SSLSupport#trust_store_path= (method)">#trust_store_path=</a></span></p>

  
  
  
  
  
  
  
  
  <h3 class="inherited">Methods included from <span class='object_link'><a href="ServerSSLSupport.html" title="Vertx::ServerSSLSupport (module)">ServerSSLSupport</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="ServerSSLSupport.html#client_auth_required-instance_method" title="Vertx::ServerSSLSupport#client_auth_required (method)">#client_auth_required</a></span>, <span class='object_link'><a href="ServerSSLSupport.html#client_auth_required%3D-instance_method" title="Vertx::ServerSSLSupport#client_auth_required= (method)">#client_auth_required=</a></span></p>

  
  
  
  
  
  
  
  
  <h3 class="inherited">Methods included from <span class='object_link'><a href="TCPSupport.html" title="Vertx::TCPSupport (module)">TCPSupport</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="TCPSupport.html#receive_buffer_size%3D-instance_method" title="Vertx::TCPSupport#receive_buffer_size= (method)">#receive_buffer_size=</a></span>, <span class='object_link'><a href="TCPSupport.html#reuse_address-instance_method" title="Vertx::TCPSupport#reuse_address (method)">#reuse_address</a></span>, <span class='object_link'><a href="TCPSupport.html#reuse_address%3D-instance_method" title="Vertx::TCPSupport#reuse_address= (method)">#reuse_address=</a></span>, <span class='object_link'><a href="TCPSupport.html#send_buffer_size-instance_method" title="Vertx::TCPSupport#send_buffer_size (method)">#send_buffer_size</a></span>, <span class='object_link'><a href="TCPSupport.html#send_buffer_size%3D-instance_method" title="Vertx::TCPSupport#send_buffer_size= (method)">#send_buffer_size=</a></span>, <span class='object_link'><a href="TCPSupport.html#send_receive_size-instance_method" title="Vertx::TCPSupport#send_receive_size (method)">#send_receive_size</a></span>, <span class='object_link'><a href="TCPSupport.html#so_linger-instance_method" title="Vertx::TCPSupport#so_linger (method)">#so_linger</a></span>, <span class='object_link'><a href="TCPSupport.html#so_linger%3D-instance_method" title="Vertx::TCPSupport#so_linger= (method)">#so_linger=</a></span>, <span class='object_link'><a href="TCPSupport.html#tcp_keep_alive-instance_method" title="Vertx::TCPSupport#tcp_keep_alive (method)">#tcp_keep_alive</a></span>, <span class='object_link'><a href="TCPSupport.html#tcp_keep_alive%3D-instance_method" title="Vertx::TCPSupport#tcp_keep_alive= (method)">#tcp_keep_alive=</a></span>, <span class='object_link'><a href="TCPSupport.html#traffic_class-instance_method" title="Vertx::TCPSupport#traffic_class (method)">#traffic_class</a></span>, <span class='object_link'><a href="TCPSupport.html#traffic_class%3D-instance_method" title="Vertx::TCPSupport#traffic_class= (method)">#traffic_class=</a></span>, <span class='object_link'><a href="TCPSupport.html#use_pooled_buffers-instance_method" title="Vertx::TCPSupport#use_pooled_buffers (method)">#use_pooled_buffers</a></span>, <span class='object_link'><a href="TCPSupport.html#use_pooled_buffers%3D-instance_method" title="Vertx::TCPSupport#use_pooled_buffers= (method)">#use_pooled_buffers=</a></span></p>

  
  
  
  
  
  
  
  
  <h3 class="inherited">Methods included from <span class='object_link'><a href="ServerTCPSupport.html" title="Vertx::ServerTCPSupport (module)">ServerTCPSupport</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="ServerTCPSupport.html#accept_backlog-instance_method" title="Vertx::ServerTCPSupport#accept_backlog (method)">#accept_backlog</a></span>, <span class='object_link'><a href="ServerTCPSupport.html#accept_backlog%3D-instance_method" title="Vertx::ServerTCPSupport#accept_backlog= (method)">#accept_backlog=</a></span></p>
<div id="constructor_details" class="method_details_list">
  <h2>Constructor Details</h2>
  
    <div class="method_details first">
  <h3 class="signature first" id="initialize-instance_method">
  
    - (<tt><span class='object_link'><a href="" title="Vertx::NetServer (class)">NetServer</a></span></tt>) <strong>initialize</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Create a new NetServer

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


36
37
38</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/net.rb', line 36</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_initialize identifier id'>initialize</span>
  <span class='rubyid_@j_del ivar id'>@j_del</span> <span class='assign token'>=</span> <span class='rubyid_org identifier id'>org</span><span class='dot token'>.</span><span class='rubyid_vertx identifier id'>vertx</span><span class='dot token'>.</span><span class='rubyid_java identifier id'>java</span><span class='dot token'>.</span><span class='rubyid_platform identifier id'>platform</span><span class='dot token'>.</span><span class='rubyid_impl identifier id'>impl</span><span class='dot token'>.</span><span class='rubyid_JRubyVerticleFactory constant id'>JRubyVerticleFactory</span><span class='dot token'>.</span><span class='rubyid_vertx identifier id'>vertx</span><span class='dot token'>.</span><span class='rubyid_createNetServer identifier id'>createNetServer</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
  
</div>


  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="close-instance_method">
  
    - (<tt>Object</tt>) <strong>close</strong>(&amp;hndlr) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Close the server. The handler will be called when the close is complete.

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


60
61
62</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/net.rb', line 60</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_close identifier id'>close</span><span class='lparen token'>(</span><span class='bitand op'>&amp;</span><span class='rubyid_hndlr identifier id'>hndlr</span><span class='rparen token'>)</span>
  <span class='rubyid_@j_del ivar id'>@j_del</span><span class='dot token'>.</span><span class='rubyid_close identifier id'>close</span><span class='lparen token'>(</span><span class='rubyid_ARWrappedHandler constant id'>ARWrappedHandler</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_hndlr identifier id'>hndlr</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="connect_handler-instance_method">
  
    - (<tt><span class='object_link'><a href="" title="Vertx::NetServer (class)">NetServer</a></span></tt>) <strong>connect_handler</strong>(&amp;hndlr) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Supply a connect handler for this server. The server can only have at most one connect handler at any one time.
As the server accepts TCP or SSL connections it creates an instance of <span class='object_link'><a href="NetSocket.html" title="Vertx::NetSocket (class)">Vertx::NetSocket</a></span> and passes it to the
connect handler.

  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>hndlr</span>
      
      
        <span class='type'>(<tt>Block</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>A block to be used as the handler</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="" title="Vertx::NetServer (class)">NetServer</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>A reference to self so invocations can be chained</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


45
46
47
48</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/net.rb', line 45</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_connect_handler identifier id'>connect_handler</span><span class='lparen token'>(</span><span class='bitand op'>&amp;</span><span class='rubyid_hndlr identifier id'>hndlr</span><span class='rparen token'>)</span>
  <span class='rubyid_@j_del ivar id'>@j_del</span><span class='dot token'>.</span><span class='rubyid_connectHandler identifier id'>connectHandler</span><span class='lbrace token'>{</span> <span class='bitor op'>|</span><span class='rubyid_j_socket identifier id'>j_socket</span><span class='bitor op'>|</span> <span class='rubyid_hndlr identifier id'>hndlr</span><span class='dot token'>.</span><span class='rubyid_call identifier id'>call</span><span class='lparen token'>(</span><span class='rubyid_NetSocket constant id'>NetSocket</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_j_socket identifier id'>j_socket</span><span class='rparen token'>)</span><span class='rparen token'>)</span> <span class='rbrace token'>}</span>
  <span class='rubyid_self self kw'>self</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="host-instance_method">
  
    - (<tt>Object</tt>) <strong>host</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Get the host

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


70
71
72</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/net.rb', line 70</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_host identifier id'>host</span>
  <span class='rubyid_@j_del ivar id'>@j_del</span><span class='dot token'>.</span><span class='rubyid_host identifier id'>host</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="listen-instance_method">
  
    - (<tt>Object</tt>) <strong>listen</strong>(port, host = &quot;0.0.0.0&quot;, &amp;hndlr) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Instruct the server to listen for incoming connections.

  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>port.</span>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>The port to listen on.</div>
      
    </li>
  
    <li>
      
        <span class='name'>host.</span>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>The host name or ip address to listen on.</div>
      
    </li>
  
    <li>
      
        <span class='name'>hndlr.</span>
      
      
        <span class='type'>(<tt>Block</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>The handler will be called when the server is listening or a failure occurred.</div>
      
    </li>
  
</ul>


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


54
55
56
57</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/net.rb', line 54</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_listen identifier id'>listen</span><span class='lparen token'>(</span><span class='rubyid_port identifier id'>port</span><span class='comma token'>,</span> <span class='rubyid_host identifier id'>host</span> <span class='assign token'>=</span> <span class='string val'>&quot;0.0.0.0&quot;</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='rubyid_hndlr identifier id'>hndlr</span><span class='rparen token'>)</span>
  <span class='rubyid_@j_del ivar id'>@j_del</span><span class='dot token'>.</span><span class='rubyid_listen identifier id'>listen</span><span class='lparen token'>(</span><span class='rubyid_port identifier id'>port</span><span class='comma token'>,</span> <span class='rubyid_host identifier id'>host</span><span class='comma token'>,</span> <span class='rubyid_ARWrappedHandler constant id'>ARWrappedHandler</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_hndlr identifier id'>hndlr</span><span class='rparen token'>)</span> <span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='rubyid_j_del identifier id'>j_del</span><span class='bitor op'>|</span> <span class='rubyid_self self kw'>self</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
  <span class='rubyid_self self kw'>self</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="port-instance_method">
  
    - (<tt>Object</tt>) <strong>port</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Get the port

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


65
66
67</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/net.rb', line 65</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_port identifier id'>port</span>
  <span class='rubyid_@j_del ivar id'>@j_del</span><span class='dot token'>.</span><span class='rubyid_port identifier id'>port</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

    <div id="footer">
  Generated on Wed Jul 17 20:30:34 2013 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.8.6.1 (ruby-1.9.3).
</div>

  </body>
</html>